import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/Layout.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Layout',
    redirect: '/home',
    component: Layout
  },
  {
    path: '/home',
    name: 'Home',
    component: Layout,
    children: [{
      path: '',
      component: () => import('../views/Home.vue')
    }],

  },
  {
    path: '/happy',
    name: 'Happy',
    component: Layout,
    children: [{
      path: '',
      component: () => import('../views/Happy.vue')
    }],

  },
  {
    path: '/new',
    name: 'New',
    component: Layout,
    children: [{
        path: '',
        component: () => import('../views/New.vue')
      },
      {
        path: '/new/id',
        name: 'news',
        component: () => import('../views/News.vue')
      }
    ],

  },
  {
    path: '/details',
    name: 'Details',
    component: Layout,
    children: [{
      path: '',
      component: () => import('../views/Details.vue')
    }],

  },
  
  {
    path: '/synopsis',
    name: 'Synopsis',
    component: Layout,
    children: [{
      path: '',
      component: () => import('../views/Synopsis.vue')
    }],

  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router